import Vue from 'vue'

import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
		cateid:'',
		gutiaotuijian:1,
		nowaddress:{
			
		},
		tihuoren:{
			
		},
		zitidian:{
			
		},
		timer:null,
		
		times:'',
		tuangoutype:1,
		
	},
    mutations: {
		setcateid(state,val){
			state.cateid=val
		},
		setgupiaotuijian(state,val){
			state.gutiaotuijian=val
		},
		settuantoutype(state,val){
			state.tuangoutype=val
		},
		settimer(state,val){
			if(val===null){
				clearInterval(state.timer)
			}else{
				state.timer=val
			}
		},
		settimes(state,val){
			state.times=val
		},
		setnewaddress(state,val){
			
			state.nowaddress=val
		},
		settihuoren(state,val){
			
			state.tihuoren=val
		},
		setzitidian(state,val){
			
			state.zitidian=val
		}
	},
    actions: {
		//相当于异步的操作,不能直接改变state的值，只能通过触发mutations的方法才能改变
	}
})
export default store
